package com.fanghuaiming.controller;

import com.fanghuaiming.dao.model.order.Order;
import com.fanghuaiming.service.order.OrderService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RestController;

/****
 * @description:
 * @version:1.0.0
 * @author fanghuaiming
 * @data Created in 2020/11/25 下午5:32
 *
 */
@RestController("order")
public class OrderController {

    @Autowired
    private OrderService orderService;

    @PostMapping(value = "/insertOrder")
    public String insertOrder(@RequestBody Order order) {

        try {
            orderService.insertOrder(order);
        } catch (Exception e) {
            e.printStackTrace();
            return "接口异常,事务回滚";
        }
        return "请求成功";
    }

}
